<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$sharelink='jy_stpinggou/licai.index//fromuser='.$_SESSION['uid'];
	$return['sharedata']=array(
			'title'=>'倍财品-在线抢购',
			'desc'=>'倍财品，多倍获利！',
			'link'=>custom_url($sharelink,true),
			'imgUrl'=>ATTACHMENT_URL.$return['pluginset']['logo']
	);
	set_html('title','倍财品');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	if($_RQ['keyword']){
		$params['title like']='%;'.$_RQ['keyword'].';%';
	}
    $orderby='createtime desc';
	$total='';
	$list=pdo_getslice('jy_stpinggou_licaigroup',$params,array($pindex,$psize),$total,'','','id desc');
	if($list){
		foreach($list as &$item){
			$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
			//按点赞数排序作品
			$pindex = max(1, 0);
			$psize = 4;
			$members=pdo_getslice('jy_stpinggou_licailog',array('uniacid'=>$_SESSION['uniacid'],'groupid'=>$item['id']),array($pindex,$psize),$total,array('mid'),'','id desc');
			foreach($members as &$mv){
				$memberinfo=pdo_get('core_members',array('id'=>$mv['mid']),array('nickname','avatar'));
				$mv['nickname']=$memberinfo['nickname'];
				$mv['avatar']=$memberinfo['avatar'];
			}
			$item['members']=$members;	
			$item['salenum']=pdo_count('jy_stpinggou_licailog',array('uniacid'=>$_SESSION['uniacid'],'groupid'=>$item['id']),'id');
		}
	}
	$return['list']=$list;
	exi($return);
}
?>